#include<bits/stdc++.h>
using namespace std;
struct node {
	int num, score;
};
bool cmp(node n1, node n2)
{
	if (n1.score == n2.score) {
		return n1.num < n2.num;
	}
	return n1.score > n2.score;
}
int main()
{
	int n, m;
//	vector<int> arr(n);
	cin >> n >> m;
	node arr[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i].num >> arr[i].score;
	}
	sort(arr, arr + n, cmp);
	int temp = floor(m * 1.5);
	int line = arr[temp - 1].score;// WA 数组下表要减一
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i].score >= line) cnt ++;
		else {
			break;
		}
	}
	cout << line << " " << cnt << endl;
	for (int i = 0; i < n; i++) {
		if (arr[i].score >= line) {
			cout << arr[i].num << " " << arr[i].score << endl;
		}
	}
	return 0;
}
// 可以用pair做 map应该也许

